var onloadstring='';
function onloadFunction(){
	IE_7_object_activation_fix();
	eval(onloadstring);
}

function isEmailValid(who) {
	var email=/^[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*@[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*\.([A-Za-z]){2,4}$/i;
	return(email.test(who));
}

function focus_text(){
	if((document.all || document.getElementsByTagName) && document.getElementById){
		var alltags3=document.all? document.all : document.getElementsByTagName("*");
		for (i=0; i<alltags3.length; i++){
			if(alltags3[i].tagName=="INPUT" && alltags3[i].className.indexOf("text")!=-1){
				alltags3[i].onfocus=function(){ this.className='text active';};
				alltags3[i].onblur=function(){ this.className='text';};
			};
			if(alltags3[i].tagName=="SELECT"){
				alltags3[i].onfocus=function(){ this.className='active';};
				alltags3[i].onblur=function(){ this.className='';};
			};
			if(alltags3[i].tagName=="TEXTAREA"){
				alltags3[i].onfocus=function(){ this.className='active';};
				alltags3[i].onblur=function(){ this.className='';};
			};
			/*if(alltags3[i].tagName=="INPUT" && alltags3[i].className.indexOf("checkbox")!=-1){
				alltags3[i].onfocus=function(){ this.className='checkbox active';};
				alltags3[i].onblur=function(){ this.className='checkbox';};
			};*/
		};
	};
}


var targettopnummer=0;
function gettargetblank(aobject){
	window.open(aobject,'targettop'+targettopnummer,'location=yes,scrollbars=yes,status=yes,titlebar=yes,toolbar=yes,menubar=yes,resizable=yes');
	w.focus();
	targettopnummer++;
	return false;
}
function opennewwindow(aobject){
	w = window.open(aobject,'targettop'+targettopnummer,'location=yes,scrollbars=yes,status=yes,titlebar=yes,toolbar=yes,menubar=yes,resizable=yes');
	w.focus();
	targettopnummer++;
	return false;
}

function onFocusInputElement(inputelement,text){
	if(inputelement.value==text) inputelement.value='';
}

function onBlurInputElement(inputelement,text){
	if(inputelement.value=='') inputelement.value=text;
}

function IE_7_object_activation_fix(){
	if (navigator.userAgent.toLowerCase().indexOf("msie") != -1 && document.all){
		objects = document.getElementsByTagName("object");
		for (var i = 0; i < objects.length; i++){
			var closedTagIndex = objects[i].outerHTML.toLowerCase().indexOf('>')
			var contents = objects[i].outerHTML.substring(0, closedTagIndex + 1);
			for (var j = 0; j < objects[i].childNodes.length; j++){
				contents += objects[i].childNodes[j].outerHTML;
			}
			contents += '</object>';
			objects[i].outerHTML = contents;
		}
	}
}




/* galery top */
var imageTopActuell=0;
var imageTopCount=0;
var imageTopTimerID = null;
var imageTopTimerDelay = 400;
function imageTopSelect(imagenummer){
	if(imagenummer!=imageTopActuell){
		//alert($$('tpl_imagetop_img_'+imageTopActuell));
		el1=$('tpl_imagetop_img_'+imageTopActuell);
		myEffect0 = el1.effect('opacity', { duration: 500 });
		myEffect0.start(1, 0);
		el2=$('tpl_imagetop_img_'+imagenummer);
		myEffect1 = el2.effect('opacity', { duration: 500 });
		myEffect1.start(0, 1);
		document.getElementById('tpl_imagetop_a_'+imageTopActuell).className='';
		document.getElementById('tpl_imagetop_a_'+imagenummer).className='actuell';
		imageTopActuell=imagenummer;
	}
	imageTopTimerDelay=400;
	return false;
}
function imageTopStartTimer(){
	if (imageTopTimerDelay==0){
		imageTopTimerID = self.setTimeout("imageTopStartTimer()", 10);
		if(imageTopActuell<imageTopCount){
			imageTopSelect(imageTopActuell+1);
		}else{
			imageTopSelect(0);
		}
	}else{
		imageTopTimerDelay--;
		imageTopTimerID = self.setTimeout("imageTopStartTimer()", 10);
	}
}
function imageTopStart(){
	/*for(i=1;i<(imageTopCount+1);i++){
		el = $('tpl_imagetop_img_'+i);
		el.setStyle('opacity', 0);
	}*/
	document.getElementById('tpl_imagetop_a_0').className='actuell';
	imageTopTimerID = self.setTimeout("imageTopStartTimer()", 10);
}


/* 
	setIconOnTextMitBild - Aktiviere die Lupe bei Bildern die vergrossert werden sollen
	onload_pngIEFix - wenn mann in die seiten einen PNG eingibt soll dieser auch in IE richtig angezeigt werden
*/
/* mootools begin */
onloadstring+='setIconOnTextMitBild();';
function setIconOnTextMitBild(){
	dta=$$('dt a');
	dta.each(function(el){
		if(document.all){
			el.addEvents({
				'mouseenter': function(){
    				el.addClass('background_position_top ');
				},
				'mouseleave': function(){
    				el.removeClass('background_position_top');
				}
			});
		}
	});
}
onloadstring+='onload_pngIEFix();';
function onload_pngIEFix(){
	if (IELowerThen7){
		img=$$('img');
		img.each(function(el){
			elproperty=el.getProperty('src');
			if(elproperty.indexOf('.png',1)>0){
				el.setProperty('style',"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/"+el.getProperty('src')+"', sizingMethod='scale');");	
				el.setProperty('src',"/clear.gif");
			}
		});
	 }
}
/* mootools end */
/* jquery begin */
/*
onloadstring+='setIconOnTextMitBild();';
function setIconOnTextMitBild(){
	$('dt a').each(function(i){
		href_a=$(this).attr('href');
		if(href_a.indexOf('tx_cms_showpic')!=-1){
			if(document.all){
				$(this).mouseover(function(){$(this).find('span').css({'background-position':'right top'});});
				$(this).mouseout(function(){$(this).find('span').css({'background-position':'left top'});});
			}
			$(this).addClass('onclickvergrossern');
			$(this).append('<span></span>');
		}
	});
}

onloadarray+='onload_pngIEFix();';
function onload_pngIEFix(){
	if (IELowerThen7){
	 	$('img').each(function(i){
	 		var image=$(this).attr('src');
	 		if(image.indexOf('.png',1) > 0){
	 			$(this).attr({'style':"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/"+image+"', sizingMethod='scale');"});
	 			$(this).attr({'src':"/clear.gif"});
	 		}
	 	});
	 }
}
*/
/* jquery end */